package com.atguigu.tingshu.order.interceptor.impl;

import com.atguigu.tingshu.order.context.SaveOrderStrategyContext;
import com.atguigu.tingshu.order.interceptor.OrderHandlerInterceptor;
import com.atguigu.tingshu.order.startegy.SaveOrderStrategy;
import com.atguigu.tingshu.vo.order.OrderInfoVo;
import org.springframework.stereotype.Service;

@Service
public class SavaOrderOrderHandlerInterceptor implements OrderHandlerInterceptor {
    @Override
    public OrderInfoVo sbumitOrderRequestProcess(OrderInfoVo orderInfoVo) {
        //在保存订单数据之前,用户选择支付方式,不同的支付方法的业务逻辑代码是不同的

        SaveOrderStrategy saveOrderStrategy = SaveOrderStrategyContext.getSaveOrderStrategy(orderInfoVo.getPayWay());
        return saveOrderStrategy.saveOrder(orderInfoVo);


    }

    @Override
    public int sort() {
        return 3;
    }
}
